﻿using EventBus.Abstractions;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Text;

namespace EventBus
{
    public abstract class DomainEvent
        : IEvent
    {
        protected DomainEvent()
        {
            AggregateRootId = Guid.NewGuid();
            AggregateRootType = this.GetType();
            Payload = JsonConvert.SerializeObject(this);
            CreateTime = DateTime.Now;
        }
        public Guid AggregateRootId { get; set; }
        public Type AggregateRootType { get; set; }
        public string Payload { get; set; }
        public DateTime CreateTime { get; set; }
    }
}
